<template>
	<view class="uni-content">
		<view class="cu-list grid col-4 no-border">
			<view class="cu-item" @click="toUrl('/pages/help/list',item.id)" v-for="(item, index) in classifyList" :key="index">
				<view class="icon">
					<image :src="item.icon" mode="aspectFill"></image>
				</view>
				<text>{{ item.name }}</text>
			</view>
		</view>
		<view class="cu-list menu sm-border">
			<view class="cu-item arrow" @click="toUrl('/pages/help/detail',item.id)" v-for="(item, index) in articleList" :key="index">
				<view class="content">
					<text class="cuIcon-title text-yellow"></text>
					<text>{{ item.title }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				classifyList:[],
				articleList:[]
			};
		},
		onLoad: function (option) {
			// this.helper.checkLogin();
			this.getData();
		},
		methods: {
			getData:function(){
				//获取基础参数
				// uni.showLoading({
				// 	title:"数据加载中",
				// 	mask:true
				// })
				let userinfo = uni.getStorageSync("userinfo");
				let timestamp = this.helper.now();
				let sign = this.helper.setSign(['timestamp='+timestamp]);
				this.helper.req({
					api:"getHelpList",
					timestamp:timestamp,
					header:{sign:sign},
					method:'GET',
				}).then(res=>{
					// console.log(res);
					this.classifyList = res.data.data.classifyList;
					this.articleList = res.data.data.articleList;

					uni.hideLoading();
				})
			},
			//链接
			toUrl:function(url,id){
				url +='?id='+id;
				// console.log(url);
				uni.navigateTo({
					url: url,
				});	
			},
		},
	};
</script>

<style lang="scss">
.icon uni-image{
    width: 84upx;
    height: 84upx;
}
</style>
